{% extends 'nav.html' %}
{% block title %}Project List{% endblock %}
{% block slideshow %}
    <br/><br/><br/>
    <form class="form-inline" role="form" action="" method="GET">
        <div class="panel panel-default">
    <div class="panel-heading">
          <div class="form-group">
            <select id="selproductid" name="productid" class="form-control">
              <option value="">-所属产品-</option>
              {% for i in productlist %}
                 <option value="{{ i.pk }}" {% if request.GET.productname  == i.pk %}selected{% endif %}>{{ i.name }}</option>
              {% endfor %}
            </select>
          </div>
          <div class="form-group">
            <select id="id_projectid" name="projectid" class="form-control">
              <option value="">-所属项目-</option>
            </select>
          </div>
          <div class="form-group">
            <div class="input-group">
                <input type="input" class="form-control" name="keyword" value="{{ request.GET.keyword }}"  placeholder="Search for Keyword">
                  <span class="input-group-btn">
                      <button class="btn btn-primary" type="submit">Go!</button>
                  </span>
              </div><!-- /input-group -->
          </div>
{#          <button type="submit" class="btn btn-primary">Search</button>#}
      </div>
        <table class="table table-striped table-bordered table-hover table-condensed">
        <thead>
          <tr>
              <th>NO.</th>
              <th>产品名称</th>
              <th>项目名称</th>
              <th>版本</th>
              <th>状态</th>
              <th>项目描述</th>
              <th>排序</th>
              <th>创建者</th>
              <th>创建时间</th>
              <th>更新者</th>
              <th>更新时间</th>
          <th></th>
          </tr>
        </thead>
        <tbody>
          {% for project in projectlist %}
            <tr>
                <td>{{ forloop.counter }}</td>
                <td>{{ project.productid }}</td>
                <td class="ac-alist-descp"><a href="{% url 'projectview' project.id %}"/> {{ project.name }}</td>
                <td>{{ project.version }}</td>
                <td>
                    {% if project.isenabled == True %}
                        <span ng-if="f.flag==true" class="label label-success ng-scope">启 用</span>
                    {% else %}
                        <span ng-if="f.flag==false" class="label label-danger ng-scope">停 用</span>
                    {% endif %}
                </td>
                <td>{{ project.descr }}</td>
                <td>{{ project.sortby }}</td>
                <td>{{ project.createat }}</td>
                <td>{{ project.createtime|date:'Y-m-d H:i:s' }}</td>
                <td>{{ project.createat }}</td>
                <td>{{ project.updatetime|date:'Y-m-d H:i:s' }}</td>
                <th>
                    <a href="{% url 'projectupdate' project.id %}" class="btn btn-sm btn-primary" role="button">编辑</a>
                    <a href="{% url 'projectdel' project.id %}" class="btn btn-sm btn-danger" role="button" onclick="return confirm('Are you Sure Deleted.')">删除</a>
                </th>
            </tr>
          {% endfor %}
        </tbody>
      </table>
    </div>
        {% if is_paginated %}
        <div class="panel-default">
        <ul class="pagination">
          <li><a href="{{ request.path }}?page=1">«</a></li>
          {% if page_obj.has_previous %}
            <li><a href="{{ request.path }}?&page={{ page_obj.previous_page_number }}">上一页</a></li>
          {% else %}
            <li class="previous disabled"><a>上一页</a></li>
          {% endif %}
          {% for i in page_obj.paginator.page_range %}
            <li {% if page_obj.number == i %}class="active"{% endif %}><a href="{{ request.path }}?page={{ i }}">{{ i }}</a></li>
          {% endfor %}
          {% if page_obj.has_next %}
            <li><a href="{{ request.path }}?page={{ page_obj.next_page_number }}">下一页</a></li>
          {% else %}
            <li class="previous disabled"><a>下一页</a></li>
          {% endif %}
          <li><a href="{{ request.path }}?page={{ page_obj.paginator.num_pages }}">»</a></li>
            <li><a>当前第{{ page_obj.number }}页/共{{ projectsum }}条</a></li>
        </ul>
    </div>
        {% endif %}
  </form>
{% endblock %}
